<?php
return (function () {
    $name = 'Baing';
    $app = 'app';
    $ext = 'ext';
    $root = str_replace('\\', '/', realpath(__DIR__ . '/..'));
    $config = [
        'name'    => $name,
        'app'     => $app,
        'ext'     => $ext,
        'hosting' => ['html'],
        'methods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
        'path'    => [
            'root'     => $root,
            'app'      => "$root/app",
            'ext'      => "$root/ext",
            'document'      => [
                'Cache'     => "$root/resources/caches",
                'Config'    => "$root/resources/configs",
                'DataTable' => "$root/resources/tables",
                'Download'  => "$root/resources/downloads",
                'Html'      => realpath("$root/../web"),
            ],
            'application' => [
                'Logger'  => "$root/resources/logs",
                'Upload'  => "$root/resources/uploads",
            ],
            'Resource'    => "$root/resources",
            'Document'    => "$root/resources/documents",
            'Application' => "$root/resources/applications",
        ],
        'Process' => [
            'index'  => 'Index',
            'custom' => 'Custom',
        ],
    ];

    $config['autoload'] = [
        'include' => ["$root/$app", "$root/$ext", "$root/bai"],
        'cache'   => "$root/resources/caches/autoload.php",
    ];

    require_once $root . '/bai/feature/Files.php';
    $config = \bai\feature\Files::mergeConfig($config, "$root/$ext/config.php");
    $config = \bai\feature\Files::mergeConfig($config, "$root/$app/config.php");

    return $config;
})();
